package com.wwy.arithmetic.newsuanfa;

/**
 * @author 王伟羽
 * @program: arithmetictest
 * @description: 搜索插入位置
 * @create: 2025/04/01
 */

public class Sousuocharuweizhi {
//输入: nums = [1,3,5,6], target = 5
    public int searchInsert(int[] nums, int target) {
        int resp = nums.length;
        int a = 0;
       while (a<nums.length){
           if(nums[a]==target){
               resp =  a;
           }else if (nums[a]>target){
               resp =  a;
               break;
           }
           a++;
       }
       return resp;
    }
}
